import request from '@/utils/request'

export function page(params) {
  return request({
    url: '/sync/job/page',
    method: 'get',
    params
  })
}

export function tableLogPage(params) {
  return request({
    url: '/sync/job/tableLog/page',
    method: 'get',
    params
  })
}

export function getById(id) {
  return request({
    url: `/sync/job/getById/${id}`,
    method: 'get'
  })
}

export function jobListGet() {
  return request({
    url: `/sync/job/list/`,
    method: 'get'
  })
}

export function dbListGet() {
  return request({
    url: `/sync/db/list`,
    method: 'get'
  })
}

export function nacosListGet() {
  return request({
    url: `/sync/db/list?type=2`,
    method: 'get'
  })
}

export function conditionListGet() {
  return request({
    url: `/sync/condition/list`,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/sync/job/',
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: '/sync/job/',
    method: 'put',
    data
  })
}

export function remove(ids) {
  return request({
    url: `/sync/job/delete/${ids}`,
    method: 'delete'
  })
}

export function run(ids) {
  return request({
    url: `/sync/job/run/${ids}`,
    method: 'post'
  })
}
